﻿//-----------------------------------------------------------------------
// <copyright file="StructureMapControllerFactory.cs" company="OverrideThis">
//     Copyright (c) 2010 OverrideThis.com
// </copyright>
//-----------------------------------------------------------------------
namespace OverrideThis.ContactManager.WebSite.Infrastructure
{
    using System.Web.Mvc;
    using StructureMap;

    public class StructureMapControllerFactory : DefaultControllerFactory
    {
        protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, System.Type controllerType)
        {
            var controller = ObjectFactory.GetInstance(controllerType) as IController;
            if (controller != null)
                return controller;
            return base.GetControllerInstance(requestContext, controllerType);
        }
    }
}